#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;

int main()
{
    int timeNow = time(NULL);
    srand(timeNow);
    int sumEven;
    int sumOdd;
    int choice;
    do {
        int arr[50];
        for(int i = 0; i <=49; i++)
        {
            arr[i] = rand() % 21;
            cout << arr[i] << "  ";
        }
        cout << endl;
        sumEven = 0;
        sumOdd = 0;
        for(int i = 0; i <=49; i++)
        {
            if(i % 2 == 0)
            {
                sumEven = sumEven + arr[i];
            }
            else
            {
                sumOdd += arr[i];
            }
        }
        cout << "Sum of all numbers on even positions: " << sumEven << endl;
        cout << "Sum of all numbers on odd positions: " << sumOdd << endl << endl;

        cout << "The sum of numbers on even positions is ";
        if(sumEven > sumOdd)
        {
            cout << "greater than";
        }
        else if (sumEven < sumOdd)
        {
            cout << "less than";
        }
        else
        {
            cout << "equal to";
        }
        cout << " the sum of numbers on add positions.";
        cout << endl << endl << endl;
        do
        {
            cout << "Press 1 to repeat or 0 to exit: ";
            cin >> choice;
        } while (choice != 0 && choice != 1);
    } while (choice != 0);
    return 0;
}
